package cn.javasea.websocket.handler.impl;

import cn.javasea.websocket.entity.JsonMessage;
import cn.javasea.websocket.utils.JacksonUtils;
import cn.javasea.websocket.utils.WsBroadcastUtil;
import com.zhirui.oauth.sucket.handler.Handler;
import org.springframework.stereotype.Component;

import javax.websocket.Session;

/**
 * @author: Ethan_Fung
 * @description:
 * @date: 2020/3/18 16:17
 * @version: 1.0
 **/
@Component
public class GetTodoHandler implements Handler {

    @Override
    public Object action(String message, Session session) {
        try {
            JsonMessage jsonMessage = JacksonUtils.json2pojo(message, JsonMessage.class);
            WsBroadcastUtil.broadcastNotifications(session, jsonMessage);
        } catch (Exception e) {
        }

        return null;
    }
}
